//
// Decompiled by Jadx - 494ms
//
package gc;

import a.g;
import a.i;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.widget.LinearLayout;
import android.widget.TextView;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
import fm.k;
import fn.j;
import fn.x;
import fn.y;
import fo.c;
import java.util.List;
import me.plusne.GreenDao.dao.SoulChatListHideDao;
import me.plusne.common.Json.JsonHookStatic;
import o.a;
import org.luckypray.dexkit.query.matchers.MethodMatcher;
import org.luckypray.dexkit.result.MethodData;
import r.e;

@a("SOUL")
public final class bf extends x {
    public static String cp;
    public static String cq;

    public static void cr(Object obj) {
        if (TextUtils.isEmpty(cp)) {
            cp = y.cn(obj.getClass(), "android.widget.PopupWindow", false);
        }
        j.aa(XposedHelpers.getObjectField(obj, cp), "dismiss");
        z.eh();
    }

    public static void cs(bf bfVar, XC_MethodHook.MethodHookParam methodHookParam, int i, String str) {
        k kVar;
        bfVar.getClass();
        JsonHookStatic jsonHookStatic = y.by;
        if (i != 1) {
            if (i != 2) {
                if (i != 3) {
                    if (i != 4) {
                        jsonHookStatic.getDb().x.r();
                        List dt = z.dt();
                        if (dt != null) {
                            for (Object obj : dt) {
                                k kVar2 = new k();
                                String as = j.as(obj, "b");
                                if (!str.equals(as)) {
                                    kVar2.b = as;
                                    jsonHookStatic.getDb().j(kVar2);
                                }
                            }
                        }
                    } else {
                        jsonHookStatic.getDb().x.r();
                        kVar = new k();
                        kVar.b = str;
                        jsonHookStatic.getDb().j(kVar);
                    }
                } else {
                    SoulChatListHideDao soulChatListHideDao = jsonHookStatic.getDb().x;
                    soulChatListHideDao.getClass();
                    g gVar = new g(soulChatListHideDao);
                    gVar.l(SoulChatListHideDao.Properties.UserId.f(str), new i[0]);
                    gVar.i(1);
                    if (((k) gVar.k()) == null) {
                        kVar = new k();
                        kVar.b = str;
                        jsonHookStatic.getDb().j(kVar);
                    }
                }
            } else {
                jsonHookStatic.getDb().x.r();
                List dt2 = z.dt();
                if (dt2 != null) {
                    for (Object obj2 : dt2) {
                        k kVar3 = new k();
                        kVar3.b = j.as(obj2, "b");
                        jsonHookStatic.getDb().j(kVar3);
                    }
                }
            }
        } else {
            jsonHookStatic.getDb().x.r();
        }
        cr(methodHookParam.thisObject);
    }

    public static TextView ct(LinearLayout linearLayout, String str) {
        JsonHookStatic jsonHookStatic = y.by;
        TextView textView = new TextView(jsonHookStatic.getActivity());
        textView.setText(str);
        textView.setTextColor(Color.parseColor(e.c(jsonHookStatic.getActivity()) ? "#DCFFFFFF" : "#AC000000"));
        textView.setTextSize(15.0f);
        textView.setGravity(17);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.gravity = 17;
        layoutParams.topMargin = e.a(jsonHookStatic.getActivity(), 9.0f);
        layoutParams.bottomMargin = e.a(jsonHookStatic.getActivity(), 9.0f);
        textView.setLayoutParams(layoutParams);
        linearLayout.addView(textView);
        return textView;
    }

    public final void a() {
        Class cls = Integer.TYPE;
        j.bd("java.util.ArrayList", "subList", new Object[]{cls, cls, new a()});
        j.ba("com.chad.library.adapter.base.BaseProviderMultiAdapter", "convert", new b());
        MethodMatcher usingStrings = MethodMatcher.create().declaredClass(y.by.getSoul().getSelectConversationActivityGet()).returnType("void").usingStrings(new String[]{"IS_HIDE_CONVERSATION"});
        Class cls2 = Boolean.TYPE;
        MethodData t = c.t(usingStrings.paramTypes(new String[]{List.class.getName(), cls2.getName(), cls2.getName()}));
        z.ct = t.getMethodName();
        j.bb(t, new c());
        j.bc("cn.soulapp.android.square.ui.PopupMenu", new Object[]{Context.class, List.class, cls2, j.ak("cn.soulapp.android.square.ui.PopupMenu.OnMenuItemClickListener"), new d(this)});
        MethodData t2 = c.t(MethodMatcher.create().declaredClass("cn.soulapp.android.component.chat.fragment.MsgFragment").usingStrings(new String[]{"取消置顶", "置顶"}));
        j.bd(t2.getClassName(), t2.getMethodName(), new Object[]{j.ak("cn.soulapp.android.user.api.bean.ChatNoticeModel"), cls, new e(this)});
        j.ba(c.t(MethodMatcher.create().usingStrings(new String[]{"功能维护中", "ChatGroup_Square_Plus_Entrance_Clk", "/im/GroupSquareActivity"})).getClassName(), "onMenuItemClick", new f());
    }
}
